﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using EntityFrameworkContrib.PostSharp4EF;
using CyclicReferences.Public;

namespace EFContrib.PS4EF.Tst.SchoolTests
{
    [Poco("SchoolEntitiesConnection")]
    [CreateSerializeSurrogate("EntityFrameworkContrib.PostSharp4EF.ISerializationHelp, EntityFrameworkContrib.PostSharp4EF")]
    [DataContract(Name = "Person", Namespace = "tstNS")]
    public class Person
    {
        [DataMember]
        public int PersonID { get; set; }
        [DataMember]
        public string LastName { get; set; }
        [DataMember]
        public string FirstName { get; set; }
        [DataMember]
        public DateTime? HireDate { get; set; }
        [DataMember]
        public DateTime? EnrollmentDate { get; set; }

        [DataMember]
        public ICollection<Enrollment> Enrollments { get; set; }
        [DataMember]
        public ICollection<Course> Courses { get; set; }

    }


    [Poco("SchoolEntitiesConnection")]
    [CreateSerializeSurrogate("EntityFrameworkContrib.PostSharp4EF.ISerializationHelp, EntityFrameworkContrib.PostSharp4EF")]
    [DataContract(Name = "Enrollment", Namespace = "tstNS")]
    public class Enrollment
    {
        [DataMember]
        public int EnrollmentID { get; set; }
        [DataMember]
        public Decimal? Grade { get; set; }

        [DataMember]
        public Course Course { get; set; }
        [DataMember]
        public Person Person { get; set; }

    }

    [Poco("SchoolEntitiesConnection")]
    [CreateSerializeSurrogate("EntityFrameworkContrib.PostSharp4EF.ISerializationHelp, EntityFrameworkContrib.PostSharp4EF")]
    [DataContract(Name = "Department", Namespace = "tstNS")]
    public class Department
    {
        [DataMember]
        public int DepartmentID { get; set; }
        [DataMember]
        public string Name { get; set; }
        [DataMember]
        public Decimal Budget { get; set; }
        [DataMember]
        public DateTime StartDate { get; set; }
        [DataMember]
        public int Administrator { get; set; }

        [DataMember]
        public ICollection<Course> Courses { get; set; }

    }

    [Poco("SchoolEntitiesConnection")]
    [CreateSerializeSurrogate("EntityFrameworkContrib.PostSharp4EF.ISerializationHelp, EntityFrameworkContrib.PostSharp4EF")]
    [DataContract(Name = "Course", Namespace = "tstNS")]
    public class Course
    {
        [DataMember]
        public int CourseID { get; set; }
        [DataMember]
        public string Title { get; set; }
        [DataMember]
        public string Days { get; set; }
        [DataMember]
        public DateTime Time { get; set; }
        [DataMember]
        public string Location { get; set; }
        [DataMember]
        public int Credits { get; set; }
        [DataMember]
        public Department Department { get; set; }

        [DataMember]
        public ICollection<Enrollment> Enrollments { get; set; }
        [DataMember]
        public ICollection<Person> Persons { get; set; }

    }

}
